//
//  MovieListTableViewCell.m
//  newDouban
//
//  Created by dllo on 15/10/15.
//  Copyright © 2015年 蓝鸥科技. All rights reserved.
//

#import "MovieListTableViewCell.h"
#import "UIImageView+WebCache.h"
@interface MovieListTableViewCell ()

@property (nonatomic, retain) UIImageView *backgroundImageV;
@property (nonatomic, retain) UIImageView *picImageV;
@property (nonatomic, retain) UILabel *nameLabel;

@end

@implementation MovieListTableViewCell


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createSubviews];
    }
    
    return self;
}


- (void)createSubviews
{
    self.backgroundColor = [UIColor whiteColor];
    self.backgroundImageV = [[UIImageView alloc] initWithFrame:CGRectMake(5, 10, 414 - 10, 200 - 20)];
    self.backgroundImageV.image = [UIImage imageNamed:@"bg_eventlistcell@2x.png"];
    [self.contentView addSubview:self.backgroundImageV];
    [_backgroundImageV release];
    
    
    self.picImageV = [[UIImageView alloc] initWithFrame:CGRectMake(self.backgroundImageV.frame.origin.x + 5, self.backgroundImageV.frame.origin.y + 10, 100, 160)];
    self.picImageV.image = [UIImage imageNamed:@"h5.jpg"];
    [self.contentView addSubview:self.picImageV];
    [_picImageV release];
    
    self.nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.picImageV.frame.origin.x + self.picImageV.frame.size.width + 10, (self.backgroundImageV.frame.size.height - 60) / 2 + 5, 280, 60)];
    //self.nameLabel.backgroundColor = [UIColor orangeColor];
    [self.contentView addSubview:self.nameLabel];
    [_nameLabel release];
    self.nameLabel.font = [UIFont boldSystemFontOfSize:24.0];
    
}


- (void)setMovie:(Movie *)movie
{
    if (_movie != movie) {
        [_movie release];
        _movie = [movie retain];
    }
    
    
    self.nameLabel.text = self.movie.movieName;
    
    NSURL *url = [NSURL URLWithString:self.movie.pic_url];
    [self.picImageV sd_setImageWithURL:url placeholderImage:[UIImage imageNamed:@"picholder.png"]];
    
}

//- (void)layoutSubviews
//{
//    [super layoutSubviews];
//    self.nameLabel.text = @"摩登森林之美食总动员";
//    
//}



- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
